package xyz.suancaiyu.userservice.service;

import com.alibaba.fastjson.JSON;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xyz.suancaiyu.userservice.config.RabbitConfig;
import xyz.suancaiyu.userservice.entity.SysLog;

/**
 * @author puruidong
 * @version 2019/1/24 22:16
 */
@Service
public class LoggerService {

    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void log(SysLog sysLog) {
        rabbitTemplate.convertAndSend(RabbitConfig.queueName, JSON.toJSONString(sysLog));
    }


}
